package com.fanjia.security01demo.controller;


import com.fanjia.security01demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author fanjia
 * @className UserController
 * @description TODO
 * @date 2021/3/25 19:19
 */
@RestController
public class UserController {

    @Autowired
    UserService userService;
    @Autowired
    PasswordEncoder passwordEncoder;


    @PostMapping("/register")
    public String register(String username,String password){
        userService.register(username,passwordEncoder.encode(password));
        return "注册成功";
    }



}
